package com.s3u4.demo.zookeeper.base;

import com.s3u4.demo.zookeeper.ZkConfig;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.ZooDefs;
import org.apache.zookeeper.ZooKeeper;

/**
 * Created by Captain on 01/12/2017.
 */
public class PersistentSequntialClient {

    public static void main(String[] args) throws Exception {
        ZooKeeper zooKeeper = new ZooKeeper(ZkConfig.ZK_HOST,ZkConfig.SESSION_TIMECOUNT,null);
        for ( int i = 1 ; i <= 10 ; i++ ){
            String str = zooKeeper.create("/persistent_sequential/lock" + i,String.valueOf(i).getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
            System.out.println(str);
        }
        while(true){

        }

    }

}
